﻿using FastReport;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ZK.Qymd_TransManage.Model;

namespace ZK.Qymd_TransManage.Test
{
    public partial class Print : Form
    {
        public Print()
        {
            InitializeComponent();
        }

        private void Button1_Click(object sender, EventArgs e)
        {
            DataGridModel bill = new DataGridModel()
            {
                WeighDate = DateTime.Now.ToString(),
                ShipperName = "我是ShipperName",
                AddNetWeight = "AddNetWeight",
                CarNum = "我是CarNum",
                CoalType = "我是CoalType",
                DeleteSign = "我是DeleteSign",
                GrossWeight = "GrossWeight",
                GrossWeightTime = DateTime.Now.ToString(),
                GrossWeightUser = "GrossWeightUser",
                id = "id",
                name = "我是name",
                NetWeight = "NetWeight",
                password = "我是password",
                ReceivingPartyName = "我是ReceivingPartyName",
                Tare = "Tare",
                TareTime = DateTime.Now.ToString(),
                TareUser = "我是TareUser",
                TicketNum = "我是TicketNum",
                TransportUnit = "我是TransportUnit",
                TruckNum = "我是TruckNum"
            };

            List<DataGridModel> dataGridModels = new List<DataGridModel>();
            dataGridModels.Add(bill);
            Report report = new Report();
            report.Load(@"QYMDBD.frx");
            report.RegisterData(dataGridModels, "DataTable");

            //预览打印
            // report.Show();
            // report.Dispose();

            //静默打印
            report.PrintSettings.ShowDialog = false;//选择打印机页面是否显示
            report.PrintSettings.Printer = @"\\WANGWEI-PC\Brother MFC-7380";
            report.Print();

            report.Dispose();

            //创建fastreport模版
            //Report report = new Report();

            //report.RegisterData(FBusinessObject, "DataTable");

            //report.Design();

            //report.Dispose();
        }
    }
}
